﻿<?xml version="1.0" encoding="utf-8"?>
<!--
        作者：          leyi.liu
        更新时间：      20150923
        用途：          生成应用服务器的初始化数据
-->
<xsl:stylesheet version="2.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:fn="http://www.w3.org/2005/xpath-functions">
	<xsl:output method="text" indent="no" encoding="utf-8" byte-order-mark="no"/>  
	<xsl:template match="/">
	<xsl:variable name="StringTypeDefine" select="document('../model/0101_StringTypeDefine.xml')"/>
	<xsl:variable name="EnumTypeDefine" select="document('../model/0102_EnumTypeDefine.xml')"/>
	<xsl:variable name="BooleanTypeDefine" select="document('../model/0103_BooleanTypeDefine.xml')"/>
	<xsl:variable name="DateTypeDefine" select="document('../model/0104_DateTypeDefine.xml')"/>
	<xsl:variable name="NumberTypeDefine" select="document('../model/0105_NumberTypeDefine.xml')"/>
	<xsl:variable name="IntegerTypeDefine" select="document('../model/0106_IntegerTypeDefine.xml')"/>
	<xsl:variable name="FuncConfig" select="document('../model/0801_AdminFunNoConfig.xml')"/>
	<xsl:result-document encoding="utf-8" method="text" href="./generate/mysql/sql/initdata/menu_init.sql">
delete from t_lz_sys_menu_config;
<xsl:for-each select="Menu">
<xsl:for-each select="First">
<xsl:variable name="FirstMenuID" select="@code"/>
insert into t_lz_sys_menu_config(MenuID,MenuName,MenuLevel,ISMenu,MenuHref,SuperMenuID,Sort,OperID,OperDate)values('<xsl:value-of  select ="$FirstMenuID"/>','<xsl:value-of select="@label"/>','1','1','href_<xsl:value-of  select ="$FirstMenuID"/>','',<xsl:value-of  select ="@sort"/>,'sys',now());
<xsl:for-each select="Second">
<xsl:variable name="SecondMenuID" select="@code"/>
insert into t_lz_sys_menu_config(MenuID,MenuName,MenuLevel,ISMenu,MenuHref,SuperMenuID,Sort,OperID,OperDate)values('<xsl:value-of  select ="$SecondMenuID"/>','<xsl:value-of select="@label"/>','2','1','href_<xsl:value-of  select ="$SecondMenuID"/>','<xsl:value-of  select ="$FirstMenuID"/>',<xsl:value-of  select ="@sort"/>,'sys',now());
<xsl:for-each select="Third">
<xsl:variable name="ThirdMenuID" select="@code"/>
insert into t_lz_sys_menu_config(MenuID,MenuName,MenuLevel,ISMenu,MenuHref,SuperMenuID,Sort,OperID,OperDate)values('<xsl:value-of  select ="$ThirdMenuID"/>','<xsl:value-of select="@label"/>','3','1','<xsl:value-of  select ="@href"/>','<xsl:value-of  select ="$SecondMenuID"/>',<xsl:value-of  select ="@sort"/>,'sys',now());
<xsl:for-each select="Func">
<xsl:variable name="func" select="@code"/>
insert into t_lz_sys_menu_config(MenuID,MenuName,MenuLevel,ISMenu,MenuHref,SuperMenuID,OperID,OperDate)values('<xsl:value-of  select ="@code"/>','<xsl:for-each select="$FuncConfig//FunNo[@code=$func]"><xsl:value-of select="@label"/></xsl:for-each>','4','0','<xsl:value-of  select ="@href"/>','<xsl:value-of  select ="$ThirdMenuID"/>','sys',now());</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
 commit;
</xsl:result-document>
	</xsl:template>  
</xsl:stylesheet>
